///functions 
#ifndef __SCRIPT_EDITOR_H
#define __SCRIPT_EDITOR_H

#include <irrlicht.h>

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif

#include <windows.h>
#include "stdafx.h"
#include <stdarg.h>

void debug_out(const char* fmt, ...)
{
	char str[1024];
	va_list arg_list;

	va_start(arg_list, fmt);
	vsprintf_s(str, fmt, arg_list);

	printf("%s", str);
	OutputDebugStringA(str);

}

#define FAIL(x , s)								if (!x) {printf("//---------------------\n//FAIL %s - %s \n//---------------------\n", #x , s);}
#define DEBUG_OUT								debug_out				
typedef void (*functionPointer)(IXMLWriter*,IAttributes*);

map<stringc,functionPointer> functionList;
map<stringc,functionPointer> levelList;

void _SetPosition( s32 objId , vector3df pos , IXMLWriter* xml , IAttributes* attr);
void _SetRotation( s32 objId , quaternion pos , IXMLWriter* xml , IAttributes* attr);
void _SetScale( s32 objId , vector3df scale , IXMLWriter* xml , IAttributes* attr);
void _MoveToPosition( s32 objId , vector3df pos , f32 speed , IXMLWriter* xml , IAttributes* attr);
void _MoveToObject( s32 objId , s32 destObj , f32 speed , IXMLWriter* xml , IAttributes* attr);
//void _MoveToPositionWithSpeed( s32 objId , s32 speed , vector3df pos , IXMLWriter* xml , IAttributes* attr);
//void _MoveToEntityWithSpeed( s32 objId , s32 speed , s32 destObj , IXMLWriter* xml , IAttributes* attr);
void _KillObject( s32 objId , IXMLWriter* xml , IAttributes* attr);
void _MoveEnemyToPosition( s32 objId , s32 state ,vector3df pos , IXMLWriter* xml , IAttributes* attr);
void _MoveEnemyToObject( s32 objId , s32 state , s32 destObj , IXMLWriter* xml , IAttributes* attr);
void _EnableAI( s32 objId ,IXMLWriter* xml , IAttributes* attr);
void _DisableAI( s32 objId ,IXMLWriter* xml , IAttributes* attr);
void _FreezeAI( s32 objId ,IXMLWriter* xml , IAttributes* attr);
void _StartEnemy( s32 objId ,IXMLWriter* xml , IAttributes* attr);
void _StopEnemy( s32 objId ,IXMLWriter* xml , IAttributes* attr);
void _FollowWayPoint( s32 objId , s32 WayPointId , f32 speed , IXMLWriter* xml , IAttributes* attr);
void _StopTest( IXMLWriter* xml , IAttributes* attr);
void _IfObjectInWayPoint( s32 ObjectId , s32 WayPointId , IXMLWriter* xml , IAttributes* attr);
void _IfObjectInPosition( s32 ObjectId , vector3df pos , IXMLWriter* xml , IAttributes* attr);
void _IfAllEnemyDead( IXMLWriter* xml , IAttributes* attr);
void _IfEnemyDead(s32 EnemyID , IXMLWriter* xml , IAttributes* attr);
void _EnableFog(IXMLWriter* xml , IAttributes* attr);
void _DisableFog(IXMLWriter* xml , IAttributes* attr);
void _SetupFog(s32 color , s32 transitionTime , s32 start , s32 end , IXMLWriter* xml , IAttributes* attr);
void _ResetFog(IXMLWriter* xml , IAttributes* attr);
void _EnableTrigger(s32 triggerID , IXMLWriter* xml , IAttributes* attr);
void _DisableTrigger(s32 triggerID , IXMLWriter* xml , IAttributes* attr);
void _OpenDoor( s32 doorID , bool keepOpen, IXMLWriter* xml ,IAttributes* attr);
void _CloseDoor( s32 doorID ,bool keepClosed , IXMLWriter* xml ,IAttributes* attr);
void _Delay(s32 timeMS, IXMLWriter* xml , IAttributes*attr);
void _SetEnemyState(s32 EnemyID,s32 state, IXMLWriter* xml , IAttributes*attr);
void _EndLevel(IXMLWriter* xml , IAttributes*attr);
void _SetAnim(s32 objectId , s32 anim , IXMLWriter* xml , IAttributes*attr);
#endif // __SCRIPT_EDITOR_H